package ca.compsci.opent.compiler.semantics;

public enum Type {
	// Order of type == order of precedence, 
	//    where 1st type has the highest precedence
	ERRONEOUS("ERRONEOUS", null),
	String("string"),
	Real64("real8"),
	Real32("real4 (real)", "^(real4|real)$"),
	Integer64("int8"),
	Integer32("int4 (int)", "^(int4|int)$"),
	Integer16("int2"),
	Integer8("int1"),
	Boolean("boolean"),
	Reference("an Object", null), //TODO: change pattern to "^.*$" when functional
	DEFERRED("DEFERRED", null);
	
	private String display, pattern;
	
	private Type(String s) {
		display = s;
		pattern = "^" + s + "$";
	}
	
	private Type(String s, String p) {
		display = s;
		pattern = p;
	}
	
	public String pattern() {
		return pattern;
	}
	
	public String toString() {
		return display;
	}
}